
// window.onload = fun1();
function fun1(){
	document.write("javascript is fun !<br");
	//alert("error");
	console.log("console output!");
	for(let i=0;i<10;i++){
		document.write("<div>div content text</div>");
		document.write("<a href='https://www.baidu.com/'>我是超链接</a>");
	}
}
window.onload = function(){
	//找到按钮
	var btn1 = document.getElementById("btn1");
	btn1.onclick = fun1;
	var btn2 = document.getElementById("btn2");
	btn2.onclick = sum;
	var btn3 = document.getElementById("btn3");
	btn3.onclick = cheng;
	
		
}

function sum(){
	let sum=0;
	for(let i=0;i<=100;i++){
		sum+=i;
	}
	document.write(sum);
	for(let i=1;i<=6;i++){
		document.write("<h"+i+">heading text"+i+"</h"+i+">")
	}
}

function cheng(){
	
	for(let i=1;i<=9;i++){
		for(let j=1;j<=i;j++){
			document.write(j+"*"+i+"="+j*i+"&nbsp;&nbsp;&nbsp;&nbsp;")
		}
		document.write("<br/>");
	}
}